import { FC, useEffect } from "react";
import "taro-ui/dist/style/index.scss";
import AppContext, { AppActionContext } from "@/context/app-context";
import { useAppData } from "@/context/app-context";
import "./app.less";
import "./assets/styles/index.less";
import Taro from "@tarojs/taro";
const App: FC = (props) => {
  const [state, action] = useAppData();
  const { refresh, update } = action;

  useEffect(() => {
    refresh();
  }, []);

  return (
    <AppContext.Provider value={state}>
      <AppActionContext.Provider value={{ refresh, update }}>
        {/*  props.children 是将要会渲染的页面 */}
        {props.children}
      </AppActionContext.Provider>
    </AppContext.Provider>
  );
};

export default App;
